package com.love.tree;

/**
 * 树的三种遍历方式
 */
public class Traversal {


    public static class Node{

        public int val;

        public Node left;

        public Node right;

        public Node(int val, Node left, Node right) {
            this.val = val;
            this.left = left;
            this.right = right;
        }
    }


    public static void process(Node node){
        if(node == null){
            return;
        }
        // 先序遍历
//        System.out.println(node.val);
        process(node.left);
        // 中序遍历
//        System.out.println(node.val);
        process(node.right);
        // 后序遍历
//        System.out.println(node.val);

    }

}
